interface ItemType{
    img:string,
    title:string,
    desc:string,
    id:string
}

interface DataType{
    code:number,
    data:ItemType[]
}

Ajax('/api/list',(data:DataType)=>{
    // console.log(data)
    render(data.data)
})
function render(data:ItemType[]){
    const box=document.querySelector('.box');
    (box as Element).innerHTML=data.map(item=>{
        return `
        <dl>
            <dt><img src='${item.img}' alt='' /></dt>
            <dd>
                <h3>${item.title}</h3>
                <p>${item.desc}</p>
            </dd>
        </dl>
        `
    }).join('')
}